//---------------------------------------------------------------------------
/**
 * \class CFile
 * \brief This is a tool for file & directory
 * \version 0.1
 *
 * \author Woo-Hyun Kim (woorung@nhncorp.com, woorung@gmail.com)
 * \author http://blog.naver.com/wisereign .
 *
 * \date 2007/04/17
 */
//---------------------------------------------------------------------------
#ifndef CFileH
#define CFileH
//---------------------------------------------------------------------------
#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <fstream>
#include <string>

#include <magic.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <fcntl.h>

using namespace std;
//---------------------------------------------------------------------------
class CFile {
private:
	string magic_number;

public :
	CFile();
	~CFile();

	const char *recognize(const char *buf);
	const char *magic(const char *file);
	bool executable(const char *file);
	int change_mode(const char *file, int mode);
	const char *mime_type(const char *file);
	int file_type(const char *file);

	string &normalize_file_path(string &file_path);
	int separate_path_and_file(string &full_path, string &path, string &file);

	bool exist_dir(const char *dir_path);
	int make_dir(const char *dir_path);
	int remove_dir(const char *dir_path);

	int copy(const char *src, const char *dst);
};
//---------------------------------------------------------------------------
#endif
